package day8;

/**
 * @author oldliu
 * @since 1.0
 */
public class ThreadWorker extends Thread {
    public ThreadWorker(String name) {
        super(name);
    }

    @Override
    public void run() {
        //工人
        while (true) {
            try {
                System.out.println("工人" + super.getName() + "干了一天的活，睡觉");
                super.sleep(2000);
                System.out.println("睡到自然醒，继续干活");
            } catch (InterruptedException e) {
                e.printStackTrace();
                System.out.println(super.getName() + "被吵醒。。。");
            }
        }
    }
}
